<?php

/**
 * This is the model class for table "petugaslapangankb".
 *
 * The followings are the available columns in table 'petugaslapangankb':
 * @property integer $plkb_id
 * @property integer $plkb_kec
 * @property integer $plkb_pplkb
 * @property integer $plkb_staffpplkb
 * @property integer $plkb_pkb
 * @property integer $plkb_plkb
 * @property integer $plkb_jml
 * @property integer $plkb_tahun
 *
 * The followings are the available model relations:
 * @property Kecamatan $plkbKec
 */
class Petugaslapangankb extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return Petugaslapangankb the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'petugaslapangankb';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('plkb_kec, plkb_pplkb, plkb_staffpplkb, plkb_pkb, plkb_plkb, plkb_jml, plkb_tahun', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('plkb_id, plkb_kec, plkb_pplkb, plkb_staffpplkb, plkb_pkb, plkb_plkb, plkb_jml, plkb_tahun', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'plkbKec' => array(self::BELONGS_TO, 'Kecamatan', 'plkb_kec'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'plkb_id' => 'Plkb',
			'plkb_kec' => 'Plkb Kec',
			'plkb_pplkb' => 'Plkb Pplkb',
			'plkb_staffpplkb' => 'Plkb Staffpplkb',
			'plkb_pkb' => 'Plkb Pkb',
			'plkb_plkb' => 'Plkb Plkb',
			'plkb_jml' => 'Plkb Jml',
			'plkb_tahun' => 'Plkb Tahun',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('plkb_id',$this->plkb_id);
		$criteria->compare('plkb_kec',$this->plkb_kec);
		$criteria->compare('plkb_pplkb',$this->plkb_pplkb);
		$criteria->compare('plkb_staffpplkb',$this->plkb_staffpplkb);
		$criteria->compare('plkb_pkb',$this->plkb_pkb);
		$criteria->compare('plkb_plkb',$this->plkb_plkb);
		$criteria->compare('plkb_jml',$this->plkb_jml);
		$criteria->compare('plkb_tahun',$this->plkb_tahun);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}